<%@page import="com.mipo.User"%>
<%@page import="com.mipo.Domain"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.HashMap"%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
	ArrayList<User> userList = new ArrayList<User>();
	User u1 = new User("kitty","123123","武汉市");
	User u2 = new User("rose","111222","上海市");
	userList.add(u1);
	userList.add(u2);
	request.setAttribute("list", userList);// 必须将list列表放入到request中，作为到jsp页面的参数
	
	Domain[] domainList = new Domain[2];
	Domain d1 = new Domain("baidu.com", new Date());
	Domain d2 = new Domain("jd.com", new Date());
	domainList[0] = d1;
	domainList[1] = d2;
	request.setAttribute("domainList", domainList);
	
	HashMap<String, User> permissionMap = new HashMap<String, User>();
	permissionMap.put("u1", u1);
	permissionMap.put("u2", u2);
	request.setAttribute("permissionMap", permissionMap);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>coreTag</title>
</head>
<body>
<!-- 遍历list -->
<table border="1px">
	<c:forEach items="${list}" var="item">
		<tr>
			<td>${item.username}</td>
			<td>${item.password}</td>
			<td>${item.address}</td>
		</tr>
	</c:forEach>
</table>
<!-- 遍历list -->
<table border="1px">
	<c:forEach items="${domainList}" var="item">
		<tr>
			<td align="center" valign="middle">${item["domain"]==null?"&nbsp;":item["domain"]}</td>
			<td align="center" valign="middle"><fmt:formatDate value="${item['bind_date']}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			<td align="center" valign="middle">
				<c:if test="${item['domain']!=null}">
					<a href="javascript:;" id="${item['domain']}" class="del">&nbsp;</a>
				</c:if>
			</td>
		</tr>
	</c:forEach>
</table>
<!-- 遍历map -->
<table border="1px">
	<c:if test="${!empty permissionMap}">
		<c:forEach items="${permissionMap}" var="item">
			<tr>
				<td>${item.value.username}</td>
				<td>${item.value.password}</td>
				<td>${item.value.address}</td>
			</tr>
		</c:forEach>
	</c:if>
</table>

</body>
</html>